<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jquery</title>
</head>
<body>
    <script src="./js/jquery.js"></script>
    <script>
        //省份数组
        let previnces = []
        //第一次请求获取省份信息
        $.get('./data/city.json',res=>{
            previnces = res.filter(r=>r.pid===0)
            //第二次请求获取城市信息
            $.get('./data/city.json',res=>{
                previnces.forEach(r=>{
                   r.citys = res.filter(c=>c.pid===r.id)
                   //第三次请求获取区县信息
                    $.get('./data/city.json',res=>{
                        r.citys.forEach(d=>{
                            d.districts = res.filter(e=>e.pid===d.id)
                        })
                    })
                })
            })
            console.log(previnces);
        })
        
    </script>
</body>
</html>